package org.dftproject.genesis.ui.agents;

import org.dftproject.genesis.core.agents.scheduler.AgentScheduler;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class Activator extends AbstractUIPlugin {

	public static final String ID = "org.dftproject.genesis.ui.agents";

	public static final String AGENT_HANDLERS_EXTENSION_POINT = "agentHandlers";

	private static Activator plugin;
	
	private AgentScheduler agentScheduler;
	
	public Activator() {
	}

	@Override
	public void start(BundleContext context) throws Exception {
		super.start(context);
		plugin = this;
		
		agentScheduler = new AgentScheduler();
		agentScheduler.start();
	}

	@Override
	public void stop(BundleContext context) throws Exception {
		agentScheduler.stop();
		
		plugin = null;
		super.stop(context);
	}

	public static Activator getDefault() {
		return plugin;
	}

	public static ImageDescriptor getImageDescriptor(String path) {
		return imageDescriptorFromPlugin(ID, path);
	}

}
